import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import AboutView from '../views/AboutView.vue'
import student from '../views/student.vue'
import StudentSystem from'../views/StudentSystem.vue'
import Login from '../views/Login.vue';
import CampusBinhai from '../views/CampusBinhai.vue';
import CampusChashan from '../views/CampusChashan.vue';
import CampusYueqing from '../views/CampusYueqing.vue';
Vue.use(VueRouter)

const routes = [
 
  { path: '/binhai', component: CampusBinhai },
  { path: '/chashan', component: CampusChashan },
  { path: '/yueqing', component: CampusYueqing },
  { path: '/login', component: Login },
  {
    path: '/student-system',
    component: StudentSystem,
    beforeEnter: (to, from, next) => {
      // 假设有一个简单的登录状态检查
      if (localStorage.getItem('isLoggedIn') !== 'true') {
        next('/login');
      } else {
        next();
      }
    }
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
